package com.qf.j2105.controller;


import com.qf.j2105.po.CarCollect;
import com.qf.j2105.po.Cart;
import com.qf.j2105.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


import java.util.List;

@RestController
public class CartController {
    @Autowired(required = true)
    CartService cartService;
    @RequestMapping("/addcart")
   // @ResponseBody
    public Cart addcartone(Cart cart){
        Cart addone = cartService.addone(cart);
        return addone;
    }

    //查看收藏
    @GetMapping("/cart")
    @ResponseBody
    public List<CarCollect> cartall(Integer uid){
        List<CarCollect> selectall = cartService.selectall(uid);
        return selectall;
    }
}
